package com.gelpag.base.business.bean;

import java.util.List;

public class PageBean<T> {

    //当前页
    private Integer pageNum = 1;
    //每页显示的总条数
    private Integer pageSize = 10;
    //总条数
    private Long totalNum;
    //是否有下一页
    private Integer isMore;
    //总页数
    private Integer totalPage;
    //开始索引
    private Integer startIndex;
    //分页结果
    private List<T> items;

    public PageBean() {
        super();
    }

    public PageBean(Integer currentPage, Integer pageSize, Long totalNum,Integer totalPage ) {
        super();
        this.pageNum = currentPage;
        this.pageSize = pageSize;
        this.totalNum = totalNum;
        this.totalPage = totalPage;
        this.startIndex = (this.pageNum - 1) * this.pageSize;
        this.isMore = this.pageNum >= this.totalPage ? 0 : 1;
    }

    public PageBean(Integer currentPage, Integer pageSize, Long totalNum,Integer totalPage, List<T> items) {
        super();
        this.pageNum = currentPage;
        this.pageSize = pageSize;
        this.totalNum = totalNum;
        this.totalPage = totalPage;
        this.startIndex = (this.pageNum - 1) * this.pageSize;
        this.isMore = this.pageNum >= this.totalPage ? 0 : 1;
        this.items = items;
    }

    public Integer getPageNum() {
        return pageNum;
    }

    public void setPageNum(Integer pageNum) {
        this.pageNum = pageNum;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public Long getTotalNum() {
        return totalNum;
    }

    public void setTotalNum(Long totalNum) {
        this.totalNum = totalNum;
    }

    public Integer getIsMore() {
        return isMore;
    }

    public void setIsMore(Integer isMore) {
        this.isMore = isMore;
    }

    public Integer getTotalPage() {
        return totalPage;
    }

    public void setTotalPage(Integer totalPage) {
        this.totalPage = totalPage;
    }

    public Integer getStartIndex() {
        return startIndex;
    }

    public void setStartIndex(Integer startIndex) {
        this.startIndex = startIndex;
    }

    public List<T> getItems() {
        return items;
    }

    public void setItems(List<T> items) {
        this.items = items;
    }
}
